package com.markbuikema.da.opdr1;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class AlgTest {

	@Test
	public void testAlgorithm1() {
		int[] output = Main.algorithm1(5000).getOutput();
		boolean[] used = new boolean[output.length];
		for (int i = 0; i < output.length; i++) {
			assertFalse(used[output[i]]);
			used[output[i]] = true;
		}
		for (boolean b : used)
			assertTrue(b);
	}

	@Test
	public void testAlgorithm2() {
		int[] output = Main.algorithm2(5000).getOutput();
		boolean[] used = new boolean[output.length];
		for (int i = 0; i < output.length; i++) {
			assertFalse(used[output[i]]);
			used[output[i]] = true;
		}
		for (boolean b : used)
			assertTrue(b);
	}

	@Test
	public void testAlgorithm3() {
		int[] output = Main.algorithm3(5000).getOutput();
		boolean[] used = new boolean[output.length];
		for (int i = 0; i < output.length; i++) {
			assertFalse(used[output[i]]);
			used[output[i]] = true;
		}
		for (boolean b : used)
			assertTrue(b);
	}

}